package com.photobucket.webapi.interfaces
{
	import com.photobucket.webapi.oauth.IOAuthRequest;
	
	import flash.events.IEventDispatcher;
	
	
	public interface IService extends IEventDispatcher
	{
		
		/**
		 * Modifies the Url of the request as nessecary
		 * @return 
		 * 
		 */
		function getAPIServer(url:String = null):String;
		/**
		 *  Override the API root usefull if you already know the API server to hit and will stick to it
		 */	
		function setAPIRoot(hostname:String):void;
		/**
		 * Returns the URL we should send the user's browser to authenticate once we have requested a Request token from the API. 
		 * @return 
		 * 
		 */
		function get userLoginURL():String;
		
		/**
		 * Makes a requests againist the API and can prioritize certian requests either a HIGH, NORMAL and LOW (1,2,3) so that
		 * API's calls indirect responce to user gestures can get priority and provide a better use experience.
		 * @param request
		 * @param responder
		 * @param priority
		 * 
		 */		
		function makeRequest(request:IOAuthRequest, priority:int = 2):void;
		
		/**
		 * Pings the API to see if it is available.  It will hit the root api server if not specified.  All failures and results will be sent to the specefied
		 * IResponder.
		 *
		 * @param responder
		 * @param server
		 * 
		 */		
		function ping(onResult:Function, onFault:Function, server:String = null):void;
		/**
		 * Convinence Method to set the Consumer information 
		 * @param consumer_key
		 * @param consumer_secret
		 * 
		 */
		function setConsumer(consumer_key:String, consumer_secret:String):void;
		
		/**
		 * Returns if the service is still processing requests
		 * @return 
		 * 
		 */
		function get running():Boolean;
		
		/**
		 * Sets the maximum number of concurrent requests to be made to the API.  Since
		 * Flash Player uses the browser the number of connections is shared browser wide on 
		 * a per-domain/per-browser basis.  If you are loading images at the same time as making
		 * requests to the API it is recommened not to set this too high.
		 * @param value Number of requests to allow
		 * 
		 */
		function set maxConcurrentRequests(value:int):void;
		function get maxConcurrentRequests():int;
		
		/**
		 * Sets the user token and the user token secret for use by the service.  This is generally
		 * get set in response to and API call to requestLogin and request 
		 * @param oauth_token
		 * @param oauth_token_secret
		 * 
		 */
		function setUserToken(oauth_token:String, oauth_token_secret:String):void;

	}
}